/*
 * Namespaces.java
 *
 * Created on July 31, 2004, 5:50 PM
 */

package org.infoset.xml.util;

import org.infoset.xml.*;

/**
 *
 * @author  alex
 */
public class Namespaces {
   
   /** Creates a new instance of Namespaces */
   private Namespaces() {
   }
   
   public static NamespaceScope getNearestScope(Item node) {
      if (node instanceof Element) {
         return ((Element)node).getNamespaceScope();
      } else if (node instanceof Document) {
         return ((Document)node).getDocumentElement().getNamespaceScope();
      } else {
         return ((Element)node.getOrigin()).getNamespaceScope();
      }
   }
   
}
